<template>
  <div class="home">
    <div class="home_left">
      <slide></slide>
      <hot :hot="hot"></hot>
      <div class="model_nav">最新发布</div>
      <list :list="list"></list>
    </div>

    <div class="home_right">
      <share></share>
      <lable></lable>
      <comment :comment="comment"></comment>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import slide from '@/components/SlideShow.vue'
import hot from '@/components/Hot.vue'
import list from '@/components/List.vue'
import lable from '@/components/Lable.vue'
import comment from '@/components/Comment.vue'
import share from '@/components/Share.vue'

export default {
  data(){
    return {
      list,
      hot,
      comment
    }
  },
  name: 'home',
  components: {
    slide,
    hot,
    list,
    lable,
    comment,
    share
  },
  methods:{
    postHomeData(){
      this.$axios.get('https://cnodejs.org/api/v1/topics').then((result) => {
        console.log(result);
        this.list = result.data.data
        this.hot = result.data.data
        this.comment = result.data.data
        // console.log(this.hot)
        // console.log(this.list)
        // console.log(this.comment)
      }).catch((err) => {
        console.log(err);
      });
    }
  },
  created(){
    this.postHomeData()
  }
}
</script>
